asp.net MVC

Migrations are enabled for context, but the database does not exist or contains no mapped tables.

Migrations are enabled for context, but the database does not exist or contains no mapped tables. , someone asked me to explain?

Migrations are enabled for context, but the database does not exist or contains no mapped tables. Use Migrations to create the database and its tables, for example by running the 'Update-Database' command from the Package Manager Console.

The database is not getting created for the first time while running the asp.net mvc application. I got this above error migrations are enabled for context and use migration to create the database and its table.

Solution:

You can solve it manually via SQL management  Studio by running the Database schema.

Run the following command in the nuget package manager console.

Update-Database command from the Package Manager Console

PM> Update-Database –Script

 

This will generate a SQL file with Schema code. Create an empty database and run the database schema, tables get created on it. 

Post your comments / questions